package com.dfbz.demo;

import com.sun.org.apache.bcel.internal.generic.NEW;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo02_标准输入流 {


    public static void main(String[] args) throws Exception {

        // 更改标准输入流的指向
        System.setIn(new FileInputStream("001.txt"));

        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        System.out.println(str);

    }

    public static void test(String[] args) throws Exception {

//        Scanner scanner = new Scanner(new FileInputStream("001.txt"));
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        System.out.println(str);
    }
}
